package file.day9_17;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemoTest {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("fos.dat");
        FileOutputStream fos = new FileOutputStream("fosCopy2.dat");
        byte[] bytes = new byte[1024*10];
        int len;
        long start = System.currentTimeMillis();
        while ((len = fis.read(bytes)) != -1){
            fos.write(bytes,0,len);//从0开始，到len，将bytes的数组内容写出。
        }
        long end = System.currentTimeMillis();
        System.out.println("复制结束，耗时"+(end-start)+"ms");
        fis.close();
        fos.close();
    }

}
